-
Notifications
You must be signed in to change notification settings - Fork 614
Allow initial call to .getReference() from any thread #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
/test connected-check |
Could you explain a bit (or link to an explanation) about why we don't have to call |
All the code that this PR touches was added or modified in the migration. The 16.0.1 RTDB client used com.google.android.gms.libs.punchclock.threads.TracingHandler as its thread handler, but that class is GMSCore internal. I replaced this code with Android's standard Handler interface. In my initial work to get this to work, I ran across a wide range of issues that all boiled down to the same thing: I couldn't submit work to a Handler on a thread that hadn't be initialized with So - with the fix here to use the main looper, I am only ever using threads that have already prepared. We already do this in other parts of the SDK, such as here: Line 93 in 00d4626
Thus, I don't need the lines I added to the integration tests anymore. That being said, I really want @bjornick to chime in on this as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Is there any concern about running those callbacks on the main thread? It almost feels like we want to run that in a separate thread of our own choosing, right? |
We used to expose this as an option (in the pre-GMSCore days), but since 3.x the callbacks only ever fire on the main thread. |
This allows me to run the following in a test app without crashes: